#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <vector>
#include <string>

using namespace std;

string convert(string s, int numRows) {

    string ret;
    int n = s.size();
    int d = 2 * numRows - 2;

    if (numRows == 1)  return s;

    for (int i = 0; i < n; i += d)
        ret += s[i];

    for (int k = 1; k < numRows - 1; ++k)
    {
        for (int i = k, j = d - k; i < n || j < n; i += d, j += d)
        {
            if (i < n)
            {
                ret += s[i];
            }
            if (j < n)
            {
                ret += s[j];
            }
        }
    }

    for (int i = numRows - 1; i < n; i += d)
        ret += s[i];

    return ret;
}

int main()
{
	return 0;
}